<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>图像封装-画点</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      canvas {
        display: block;
        width: 100vw;
        height: 100vh;
      }
    </style>
  </head>
  <body>
    <canvas id="canvas"></canvas>
    <script src="./main/index.js"></script>
    <script>
      const shape = new Shape("#canvas");
      window.addEventListener("click", (event) => {
        const x = (event.clientX / window.innerWidth - 0.5) * 2; // 0~1 -0.5~0.5 -1~1
        const y = -(event.clientY / window.innerHeight - 0.5) * 2;
        shape.drawPoint(x, y);
      });
    </script>
  </body>
</html>
